/*
 *
 * K-Two Javascript
 *
 */

$(function(){

	$('a img').hover(
		function(){
			if($(this).parents("div").attr("id") != "keyvisual"){
				$(this).fadeTo(0, 0.1).fadeTo('fast', 1);
			}
		},
		function(){
			if($(this).parents("div").attr("id") != "keyvisual"){
				$(this).fadeTo('fast', 1);
			}
		}
	);

	if ($('#slider1')[0]) {
		$("#slider1").responsiveSlides({
			maxwidth: 980,
			speed: 800
		});
	}


	$('.on-off img').hover(function(){
		$(this).attr('src', $(this).attr('src').replace('_off', '_on'));
	},function(){
		$(this).attr('src', $(this).attr('src').replace('_on', '_off'));
	});
	
	var menuonoff = 0;
	$('#sp-menu-button').click(function(){
		$('#sp-menu').animate({height: 'toggle'},'fast');
	});
	$('.sp-menu-close').click(function(){
		$('#sp-menu').animate({height: 'toggle'},'fast');
	});
	
	
	//各サロン地図
	//銀座
	if ($('#gmap-ginza').get(0)) { mapWrite('gmap-ginza', 35.669145, 139.762334, 16); }
	//青山
	if ($('#gmap-aoyama').get(0)) { mapWrite('gmap-aoyama', 35.668198, 139.708116, 16); }
	//名古屋
	if ($('#gmap-nagoya').get(0)) { mapWrite('gmap-nagoya', 35.164976, 136.906384, 16); }
	//prier
	if ($('#gmap-prier').get(0)) { mapWrite('gmap-prier', 35.172286, 136.888433, 16); }
	//心斎橋
	if ($('#gmap-shinsaibashi').get(0)) { mapWrite('gmap-shinsaibashi', 34.66966, 135.499991, 16); }
	//あべの
	if ($('#gmap-abeno').get(0)) { mapWrite('gmap-abeno', 34.645096, 135.51153, 16); }
	//梅田
	if ($('#gmap-umeda').get(0)) { mapWrite('gmap-umeda', 34.705664, 135.500701, 16); }
	//corso
	if ($('#gmap-corso').get(0)) { mapWrite('gmap-corso', 34.70817, 135.498387, 16); }
	//add
	if ($('#gmap-add').get(0)) { mapWrite('gmap-add', 34.66966, 135.499991, 16); }
	//西宮
	if ($('#gmap-nishinomiya').get(0)) { mapWrite('gmap-nishinomiya', 34.743866, 135.359993, 16); }
	//京都
	if ($('#gmap-kyoto').get(0)) { mapWrite('gmap-kyoto', 35.002905, 135.760008, 16); }

});

function mapWrite(id, lat, lng, zoom){
	var latlng = new google.maps.LatLng(lat, lng);
	var opts = { zoom: zoom, mapTypeId: google.maps.MapTypeId.ROADMAP, center: latlng };
	var map = new google.maps.Map(document.getElementById(id), opts);
	var markerOpts = { position: latlng, map: map };
	var marker = new google.maps.Marker(markerOpts);
}

function campaign_vegitable1(){
	location.href='http://www.k-two.jp/campaign/vegetable1/';
}
function campaign_vegitable2(){
	location.href='http://www.k-two.jp/campaign/vegetable2/';
}